package com.niuquan.activitie;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.alibaba.mobileim.YWAPI;
import com.alibaba.mobileim.YWIMKit;
import com.niuquan.adapter.ChatListAdapter;
import com.niuquan.modal.ChatListItems;

/**
 * Created by DELL on 2015/5/23.
 */
public class ChatFragment extends Fragment {
    private ListView chatListview;
    private ChatListAdapter chatListAdapter;
    YWIMKit mIMkit;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mIMkit = YWAPI.getIMKitInstance();
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        return inflater.inflate(R.layout.layout_contacts, container, false);
    }
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        chatListview = (ListView)getView().findViewById(R.id.contactslistview);
        ChatListItems item = new ChatListItems("hahaha","/sdcard/img_axset.png","asas","12:45","c++",true);
        item.setM_tag("id");
        ExpertCircle.recentContacts.add(item);
        chatListAdapter = new ChatListAdapter(getActivity(),ExpertCircle.recentContacts);
        chatListview.setAdapter(chatListAdapter);
//        chatListview.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                String target = v.getTag().toString();
//                Intent intent =mIMkit.getChattingActivityIntent(target);
//                startActivity(intent);
//            }
//        });
    }
}
